import regex

fn main() {
	txt := '
	my phone number is (999)333-4444, my brothers phone number is (999)333-4445.
	my email is alice.123+tag@domain.co.uk, and my brother uses bob_smith-89@sub.domain.com.
	'
	println(txt)

	// 电话号码正则：匹配 (XXX)XXX-XXXX 格式
	phone_pattern := r'(\+\d{2})?\(\d{3}\)\d{3}-\d{4}'
	mut phone_re := regex.regex_opt(phone_pattern) or { panic(err) }
	phones := phone_re.find_all_str(txt)
	println('Phones: $phones')

	email_pattern := r'\w+@\w+\.\w+'
	mut email_re := regex.regex_opt(email_pattern) or { panic(err) }
	emails := email_re.find_all_str(txt)
	println('Emails: $emails')

	
}
